<template>
	<view class="content">
		<view class="headerLay">
			<view class="title">
				TB号认证
			</view>
			<view class="subTitle">
				请输入TB订单号
			</view>
		</view>
		<view class="inputLay">

			<uni-easyinput :styles="styles" :placeholderStyle="placeholderStyle" primaryColor="#FF9BA7"
				placeholder="请输入TB订单号" v-model="value">

			</uni-easyinput>
		</view>
		<view class="buttonLay">
			<view class="butStyle butAction" @click="updateUserInfo">
				绑定
			</view>
			<view class="butStyle">
				绑定后不可更改
			</view>
		</view>
		<view class="tipLay">
			<view class="tipTitle">
				绑定说明：

			</view>
			<view class="tipTxt">
				{{taobaogonggao}}
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				placeholderStyle: "color:#B6B6B6;font-size:12px",

				styles: {
					backgroundColor: " #F2F2F2",
					color: '#343434',
					borderColor: '#F2F2F2'
				},

				value: '',
				codeType: false,
				codeNum: 60,
				taobaogonggao: ''
			}
		},
		onLoad() {
			this.systemConfigsFn();
		},
		async onShow() {
			await this.$onLaunched
		},
		// onShareAppMessage(res) {
		// 	return {
		// 		title: "给你分享了一份宝藏，快进来看看～",
		// 		path: '/pages/index/index',
		// 		imageUrl: '../../static/share.png'
		// 	};
		// },
		methods: {
			updateUserInfo() {
				if (this.value == '') {
					return this.$showToast('请输入TB订单号');
				}

				this.$http('/v1/users/update-info', {
					taobao_id: this.value
				}, 'POST').then(res => {
					console.log(res);
					if (res.code == 0) {
						this.$showToast('修改成功');
						this.getOpenerEventChannel().emit('refreshData')
						setTimeout(() => uni.navigateBack(), 500);
					} else {
						this.$showToast(res.msg)
					}
				})
			},
			// 配置
			systemConfigsFn() {
				this.$http('/v1/users/system-configs', {

				}).then(res => {
					console.log(res, "搜索");
					if (res.code == 0) {
						const
							data = res.data;
						this.taobaogonggao = data.configs.taobaogonggao.value || ''
					} else {
						this.$showToast(res.msg)
					}
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.content {
		width: 668upx;
		margin: 0 auto;
	}

	.headerLay {
		margin-top: 170upx;
		margin-bottom: 120upx;

		.title {
			font-weight: 500;
			font-size: 42upx;
			color: #000000;
			line-height: 57upx;
			letter-spacing: 1px;
			margin-bottom: 15upx;
		}

		.subTitle {
			font-weight: 500;
			font-size: 27upx;
			color: #ABABAB;
			line-height: 38upx;
			letter-spacing: 1px;
		}
	}


	::v-deep .inputLay {

		.uni-easyinput {
			.is-input-border {
				border-radius: 34upx;

				// height: 70upx;
				.uni-easyinput__content-input {
					padding-left: 30px;

				}
			}
		}
	}

	.rightLay {
		font-weight: 300;
		font-size: 23upx;
		color: #343434;
		line-height: 32upx;
		margin-right: 30upx;
	}

	.asdasd {
		padding-top: 30px !important;
	}

	.buttonLay {
		margin-top: 186upx;
		margin-bottom: 190upx;

		.butStyle {
			font-family: PingFangSC, PingFang SC;
			width: 668upx;
			height: 69upx;
			border-radius: 34upx;
			text-align: center;
			line-height: 69upx;
			font-weight: 500;
			font-size: 23upx;
			color: #B6B6B6;

		}

		.butAction {
			font-size: 27upx;
			color: #FFFFFF;
			background: #FF9BA7;
			margin-bottom: 10upx;
		}

	}

	.tipLay {
		font-family: PingFangSC, PingFang SC;
		font-weight: 300;
		font-size: 23upx;
		color: #B6B6B6;
		line-height: 32upx;
		text-align: left;

		.tipTxt {
			white-space: pre-line;
		}
	}
</style>
